package com.zjh;


import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.zjh.bean.Student;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;

import java.io.IOException;
import java.io.Reader;
import java.util.List;

/**
 * @author LiZiQiu
 * @data 2023/2/28
 */
public class Test1_2 {
    public static void main(String[] args) {
        try {
            Reader reader = Resources.getResourceAsReader("mybatis-config.xml");
            SqlSessionFactoryBuilder builder = new SqlSessionFactoryBuilder();
            SqlSessionFactory build = builder.build(reader,"a2");
            SqlSession session = build.openSession();


            List<Student> list = session.selectList("com.zjh.dao.StudentDao.getall");

            for (Student student : list) {
                System.out.println(student);
            }
            session.close();
            reader.close();
        } catch (IOException e) {
            e.printStackTrace();
        }

    }
}
